package com.th.atguigu.dao;

import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * @author ThreePure
 * @date 2022/3/11 9:08
 * @description: TODO
 * @since 1.8
 */
@Repository
public class AccountMapperImpl implements AccountMapper {

    private SqlSessionTemplate sqlSessionTemplate;

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSessionTemplate = sqlSession;
    }

    /**
     * 转入资金
     */
    @Override
    public void addMoney(Map<String,Object> map) {
        AccountMapper mapper = sqlSessionTemplate.getMapper(AccountMapper.class);
        mapper.addMoney(map);
    }

    /**
     * 转出资金
     */
    @Override
    public void reduceMoney(Map<String,Object> map) {
        AccountMapper mapper = sqlSessionTemplate.getMapper(AccountMapper.class);
        mapper.reduceMoney(map);
    }
}
